/**
 * 文章模型 
 * 
*/
module.exports = (sequelize, Sequelize) => {
    return sequelize.define("article", {
        id: {
            type:Sequelize.UUID,
            notNull: true,
            primaryKey: true,
            defaultValue: Sequelize.UUIDV4,
        },
        articleSort: {
            type: Sequelize.INTEGER,
            notNull: true,
            notEmpty: true,
            comment:'文章排序',
            field:'article_sort'
        },
        articleAuthor: {
            type: Sequelize.STRING,
            notEmpty: true,
            comment:'作者',
            field:'article_author'
        },
        sortName: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment:'文章类型',
            field:'sort_type'
        },
        // sort_id: {
        //     type: Sequelize.STRING,
        //     notNull: true,
        //     notEmpty: true,
        //     comment:'文章类型id',
        // },
        articleTitle: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '文章标题',
            field:'article_title'
        },
        articleSummary: {
            type: Sequelize.STRING,
            notNull: true,
            notEmpty: true,
            comment: '文章摘要',
            field:'article_summary'
        },
        articleContent: {
            type: Sequelize.TEXT("long"),
            notEmpty: true,
            comment: '文章内容',
            field:'article_content'
        },
        articleCover: {
            type: Sequelize.STRING,
            comment: '文章封面',
            field:'article_cover'
        },
        status: {
            type: Sequelize.STRING(2),
            notEmpty: true,
            defaultValue: '0',
            comment: '状态 0:草稿 1:已发布 2:已下架'
        },
        viewsCount: {
            type: Sequelize.INTEGER,
            notEmpty: true,
            defaultValue: 0,
            comment: '文章浏览量',
            field:'views_count'
        },
        commentsCount: {
            type: Sequelize.INTEGER,
            notEmpty: true,
            defaultValue: 0,
            comment: '文章评论数',
            field:'comments_count'
        },
        likesCount: {
            type: Sequelize.INTEGER,
            notEmpty: true,
            defaultValue: 0,
            comment: '文章点赞数',
            field:'likes_count'
        },
        isTop: {
            type: Sequelize.BOOLEAN,
            notEmpty: true,
            defaultValue: false,
            comment: '是否顶置',
            field:'is_top'
        },
        isHot: {
            type: Sequelize.BOOLEAN,
            notEmpty: true,
            defaultValue: false,
            comment: '是否火热',
            field:'is_hot'
        },
        isRecommend: {
            type: Sequelize.BOOLEAN,
            notEmpty: true,
            defaultValue: false,
            comment: '是否推荐',
            field:'is_recommend'
        },
        reprint: {
            type: Sequelize.STRING,
            comment: '转载地址',
        },
        editType: {
            type: Sequelize.STRING,
            comment: 'md',
            field:'edit_type'
        },
    })
}